import { Company, UserInfo } from '#/entity.ts';
import apiClient from '@/api/apiClient.ts';

export interface LoginParams {
  userName: string;
  password: string;
}

export enum UserApi {
  Login = '/roadCure/user/login',
  UserInfo = '/roadCure/user/info',
  CompanyList = '/roadCure/user/getCompanyList',
}

const login = (params: LoginParams) =>
  apiClient.get<UserInfo>({
    url: UserApi.Login,
    params,
  });
const getUserInfo = () => apiClient.get<UserInfo>({ url: UserApi.UserInfo });
const getCompanyList = () => apiClient.get<Company[]>({ url: UserApi.CompanyList });

export default {
  login,
  getUserInfo,
  getCompanyList,
};
